package com.sanjiahantang.ythshopping.presenter;

import android.content.Context;

import com.sanjiahantang.ythshopping.config.ConfigValue;
import com.sanjiahantang.ythshopping.http.BaseDelegate;
import com.sanjiahantang.ythshopping.http.ExceptionHelper;
import com.sanjiahantang.ythshopping.http.OkHttpClientManager;
import com.sanjiahantang.ythshopping.model.DillModel;
import com.sanjiahantang.ythshopping.utils.Utils;
import com.sanjiahantang.ythshopping.views.DillView;
import com.squareup.okhttp.Request;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by admin on 2017/7/25.
 */

public class DillPresenter extends BasePresenter {
    Context context;
    DillView dillview;


    public DillPresenter(Context context, DillView dillview)
    {
        this.context=context;
        this.dillview=dillview;

    }

    public void LoadDillMsg(){
        Map<String ,String > params=new HashMap<>();
        params.put("key", ConfigValue.DATA_KEY);
        OkHttpClientManager.postAsyn(context, ConfigValue.APP_IP + "order/getInvoice", params, new BaseDelegate.ResultCallback<DillModel>() {
            @Override
            public void onError(Request request, Object tag, Exception e) {
                Utils.showToast(context, ExceptionHelper.getMessage(e, context));
            }

            @Override
            public void onResponse(DillModel response, Object tag) {
                dillview.returnDill(response);
            }


        });
    }



}
